/*
 * Copyright 2007 www.luzand.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var yrprxKeyboardHelper = {
    VK_ESCAPE : 27,
    VK_SPACE  : 32,
    VK_LEFT   : 37,
    VK_RIGHT  : 39,
    VK_UP     : 38,
    VK_DOWN   : 40,
    VK_PAGE_UP: 33,
    VK_PAGE_DOWN : 34,
    VK_HOME   : 36,
    VK_END    : 35,
    VK_INSERT : 45,
    VK_DELETE : 46,
    VK_F4     : 115,
    KEY_MASK_ATL : 2,
    KEY_MASK_CTRL : 4,
    KEY_MASK_META : 8,
    KEY_MASK_ACCEL : 4 /*KEY_MASK_CTRL*/
};

yrprxKeyboardHelper.getKeyboardModifiers = function (event)
{
    if (!event) event = window.event;

    var modifiers = 0;

    if (event.altKey)  modifiers |= yrprxKeyboardHelper.KEY_MASK_ATL;
    if (event.ctrlKey) modifiers |= yrprxKeyboardHelper.KEY_MASK_CTRL;
    if (event.metaKey) modifiers |= yrprxKeyboardHelper.KEY_MASK_META;

    return modifiers;
}
